home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00418_Multi-CD Video Fetching.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  7.5 KB  |  302 lines

  1. property iMyCDlist, iSourceCDnum, iMacCDtitlesLU, iBlockIt, iPixelRefCast, iBaseLeft, iCancelBaseCast, iProceedBaseCast, iProceedHiliteCast, iCancelHiliteCast, iProceedSprNum, iCancelSprNum, iSwapMode, iScriptToRun, iXOBJopen
  2. global gAssetPath, gRunFromCD, gDXRonCD, gWINdriveLetter, gComputerTypeK, gPDL, gcurrentmedialist
  3.  
  4. on birth me
  5.   global gMyMACvolName
  6.   set iMyCDlist to EMPTY
  7.   set iSourceCDnum to 0
  8.   set iMacCDtitlesLU to [:]
  9.   addProp(iMacCDtitlesLU, "1", "OMNIPEDIA")
  10.   addProp(iMacCDtitlesLU, "2", "TNG EPISODES")
  11.   addProp(iMacCDtitlesLU, "3", "TOS EPISODES")
  12.   addProp(iMacCDtitlesLU, "4", "OMNIPEDIA 2")
  13.   addProp(iMacCDtitlesLU, "5", "DS9 EPISODES")
  14.   mCreateCDlist(me)
  15.   set iScriptToRun to EMPTY
  16.   set iSwapMode to #video
  17.   set iPixelRefCast to the number of cast "Pixel Ref for cancel/proceed base"
  18.   set iProceedBaseCast to the number of cast "proceed base"
  19.   set iCancelBaseCast to the number of cast "cancel base"
  20.   set iCancelHiliteCast to the number of cast "cancel CD hl"
  21.   set iProceedHiliteCast to the number of cast "proceed CD HL"
  22.   set iCancelSprNum to 35
  23.   set iProceedSprNum to 48
  24.   set iXOBJopen to objectp(factory("AppleCD SC XObject"))
  25.   if getaProp(iMacCDtitlesLU, 4) <> gMyMACvolName then
  26.     hputmsg("!!!! check the setting of gMyMacVolName against the iMacCDtitlesLU list. Bad match.")
  27.   end if
  28.   return me
  29. end
  30.  
  31. on mShowBase me
  32.   puppetSprite(iProceedSprNum, 1)
  33.   puppetSprite(iCancelSprNum, 1)
  34.   set the castNum of sprite iProceedSprNum to iProceedBaseCast
  35.   set the castNum of sprite iCancelSprNum to iCancelBaseCast
  36.   updateStage()
  37. end
  38.  
  39. on mZapBase me
  40.   set the castNum of sprite iProceedSprNum to iPixelRefCast
  41.   set the castNum of sprite iCancelSprNum to iPixelRefCast
  42.   puppetSprite(iCancelSprNum, 0)
  43.   puppetSprite(iProceedSprNum, 0)
  44.   updateStage()
  45. end
  46.  
  47. on mActivateCanProButts me
  48.   mShowBase(me)
  49. end
  50.  
  51. on mClearCanProButts me
  52.   if the castNum of sprite iProceedSprNum <> iPixelRefCast then
  53.     mZapBase(me)
  54.   end if
  55. end
  56.  
  57. on mCreateCDlist me
  58.   set iMyCDlist to EMPTY
  59.   set Lwhat to the text of cast "History of Updates"
  60.   set lk to the number of lines in Lwhat
  61.   repeat with i = 1 to lk
  62.     if line i of Lwhat contains "OMNI" then
  63.       set Lstart to offset("OMNI", line i of Lwhat)
  64.       set Lnum to value(char 4 + Lstart of line i of Lwhat)
  65.       if (Lnum > 0) and (Lnum < 10) then
  66.         put Lnum after iMyCDlist
  67.       end if
  68.     end if
  69.   end repeat
  70.   if iMyCDlist contains "4" then
  71.     put "1" after iMyCDlist
  72.   end if
  73. end
  74.  
  75. on mAnyCDiOwnIsMounted me
  76.   set Lcount to the number of chars in iMyCDlist
  77.   if Lcount < 1 then
  78.     return 0
  79.   end if
  80.   repeat with k = 1 to Lcount
  81.     set Lnum to char k of iMyCDlist
  82.     if gComputerTypeK = #WIN then
  83.       if hFileIsHere(gWINdriveLetter & ":" & gPDL & "OMNI" & Lnum & ".TXT") then
  84.         return 1
  85.       end if
  86.       next repeat
  87.     end if
  88.     if hFileIsHere(getaProp(iMacCDtitlesLU, Lnum) & gPDL & "OMNI" & Lnum & ".TXT") then
  89.       return 1
  90.     end if
  91.   end repeat
  92.   return 0
  93. end
  94.  
  95. on mAnyOMNICDIsMounted me
  96.   if gComputerTypeK = #WIN then
  97.     if hFileIsHere(gWINdriveLetter & ":" & gPDL & "OMNI" & string(1) & ".TXT") then
  98.       return -1
  99.     end if
  100.   else
  101.     if hFileIsHere(getaProp(iMacCDtitlesLU, 1) & gPDL & "OMNI" & string(1) & ".TXT") then
  102.       return -1
  103.     end if
  104.   end if
  105.   repeat with k = 2 to 4
  106.     if gComputerTypeK = #WIN then
  107.       if hFileIsHere(gWINdriveLetter & ":" & gPDL & "OMNI" & string(k) & ".TXT") then
  108.         return 1
  109.       end if
  110.       next repeat
  111.     end if
  112.     if hFileIsHere(getaProp(iMacCDtitlesLU, k) & gPDL & "OMNI" & string(k) & ".TXT") then
  113.       return 1
  114.     end if
  115.   end repeat
  116.   return 0
  117. end
  118.  
  119. on mClearCDNum me
  120.   set iSourceCDnum to EMPTY
  121. end
  122.  
  123. on mSetCDNum me, pTowhat
  124.   set iSourceCDnum to string(integer(pTowhat * -1))
  125. end
  126.  
  127. on mIownthisCD me
  128.   return iMyCDlist contains iSourceCDnum
  129. end
  130.  
  131. on mVidCDisMounted me
  132.   global gVideoPath
  133.   if iSourceCDnum = EMPTY then
  134.     hputmsg(">!mVidCDisMounted thinks iSourceCDnum is empty!")
  135.     return 0
  136.   end if
  137.   if (iSourceCDnum = 1) and (iMyCDlist contains "4") then
  138.     set iSourceCDnum to 4
  139.   end if
  140.   if gComputerTypeK = #WIN then
  141.     if hFileIsHere(gWINdriveLetter & ":" & gPDL & "OMNI" & iSourceCDnum & ".TXT") then
  142.       set gVideoPath to gWINdriveLetter & ":" & gPDL & "MEDIA" & gPDL
  143.       return 1
  144.     else
  145.       return 0
  146.     end if
  147.   else
  148.     if hFileIsHere(getaProp(iMacCDtitlesLU, iSourceCDnum) & gPDL & "OMNI" & iSourceCDnum & ".TXT") then
  149.       set gVideoPath to getaProp(iMacCDtitlesLU, iSourceCDnum) & gPDL & "MEDIA" & gPDL
  150.       return 1
  151.     else
  152.       return 0
  153.     end if
  154.   end if
  155. end
  156.  
  157. on mRunningFromHD me
  158.   if gRunFromCD or gDXRonCD then
  159.     return 0
  160.   else
  161.     return 1
  162.   end if
  163. end
  164.  
  165. on mEvaluateVidPlay me, pQTshortnm
  166.   mSetCDNum(me, getAt(gcurrentmedialist, 3))
  167.   if mIownthisCD(me) then
  168.     if mVidCDisMounted(me) then
  169.       hShowVidButton(pQTshortnm)
  170.     else
  171.       if mRunningFromHD(me) then
  172.         hShowAltVidButton(pQTshortnm)
  173.       else
  174.       end if
  175.     end if
  176.   end if
  177. end
  178.  
  179. on mRequestCDSwap me, pWhat
  180.   if mRunningFromHD(me) then
  181.     if gComputerTypeK = #mac then
  182.       mEjectMe(me)
  183.     end if
  184.     mActivateCanProButts(me)
  185.     set iSwapMode to pWhat
  186.     mAsk(me, pWhat)
  187.   else
  188.     hputmsg("! mRequestCDSwap tinks yooze not running from da HD, so you cant swap.")
  189.     abort()
  190.   end if
  191. end
  192.  
  193. on mAsk me, pWhat
  194.   if pWhat = "Media" then
  195.     set lx to 4
  196.   else
  197.     set lx to iSourceCDnum
  198.   end if
  199.   set Lmyname to getaProp(iMacCDtitlesLU, lx)
  200.   hReportStatus("For this " & pWhat & ", insert the >" & Lmyname & "< CD and click PROCEED.")
  201. end
  202.  
  203. on mButtonHit me, pWhich, psprnum
  204.   puppetSprite(psprnum, 1)
  205.   set Lme to the castNum of sprite psprnum
  206.   repeat while the stillDown
  207.     set the castNum of sprite psprnum to the castNum of sprite psprnum + rollOver(psprnum)
  208.     updateStage()
  209.     set the castNum of sprite psprnum to Lme
  210.   end repeat
  211.   if rollOver(psprnum) = 0 then
  212.     return 
  213.   end if
  214.   updateStage()
  215.   mButtonAction(me, pWhich)
  216. end
  217.  
  218. on mButtonAction me, pWhich
  219.   if pWhich = #PROCEED then
  220.     if iSwapMode = #video then
  221.       mProceedVid(me)
  222.     else
  223.       if iSwapMode = #MEDIA then
  224.         mCancelTheSwap(me)
  225.         do(iScriptToRun)
  226.       end if
  227.     end if
  228.   else
  229.     if pWhich = #CANCEL then
  230.       mCancelTheSwap(me)
  231.     end if
  232.   end if
  233. end
  234.  
  235. on mCancelTheSwap me
  236.   hReportStatus(" ")
  237.   mClearCanProButts(me)
  238. end
  239.  
  240. on mProceedVid me
  241.   global gNopeSND
  242.   if mVidCDisMounted(me) then
  243.     mCancelTheSwap(me)
  244.     hOpenVideo()
  245.   else
  246.     hearit(gNopeSND)
  247.     if gComputerTypeK = #mac then
  248.       mEjectMe(me)
  249.     end if
  250.     mAsk(me, #video)
  251.   end if
  252. end
  253.  
  254. on mEjectMe me
  255.   if not iXOBJopen then
  256.     openXLib(the pathName & "AppleCD SC XObject")
  257.   end if
  258.   if objectp(LCD) then
  259.     LCD(mdispose)
  260.   end if
  261.   set LCD to AppleCD(mnew)
  262.   if not objectp(LCD) then
  263.     alert("CD ejector failed to initialize.")
  264.     exit
  265.   end if
  266.   LCD(mEject)
  267.   if objectp(LCD) then
  268.     LCD(mdispose)
  269.   end if
  270.   if not iXOBJopen then
  271.     closeXLib(the pathName & "AppleCD SC XObject")
  272.   end if
  273. end
  274.  
  275. on mCheckForHomeCD me, pWhatScript
  276.   global gVidIsPlaying
  277.   mSetCDNum(me, "-4")
  278.   if gComputerTypeK = #WIN then
  279.     if hFileIsHere(gWINdriveLetter & ":" & gPDL & "OMNI" & 4 & ".TXT") then
  280.       return 1
  281.     else
  282.       if gVidIsPlaying then
  283.         return 0
  284.       end if
  285.       mRequestCDSwap(me, #MEDIA)
  286.       set iScriptToRun to pWhatScript
  287.       return 0
  288.     end if
  289.   else
  290.     if hFileIsHere(getaProp(iMacCDtitlesLU, 4) & gPDL & "OMNI" & 4 & ".TXT") then
  291.       return 1
  292.     else
  293.       if gVidIsPlaying then
  294.         return 0
  295.       end if
  296.       mRequestCDSwap(me, #MEDIA)
  297.       set iScriptToRun to pWhatScript
  298.       return 0
  299.     end if
  300.   end if
  301. end
  302.